// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 获取模块页树结构 GET /api/module/tree */
export async function queryModuleTree(params: {type?:string},options?: { [key: string]: any }) {
  return request<API.TreeNodeItem[]>('/api/module/tree', {
    method: 'GET',
    ...(options || {}),
    params: {
      ...params,
    },
 
  });
}

/** 获取菜单数据 GET /api/module/menu */
export async function queryMenuTree(options?: { [key: string]: any }) {
  return request<API.MenuDataItem[]>('/api/module/menu', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取模块列表 GET /api/module */
export async function queryModule(
  params: {
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
    parentId?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.RequestData>('/api/module', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 更新模块 PUT /api/module */
export async function updateModule(body: API.ModuleItem, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/module', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 添加模块 POST /api/module */
export async function addModule(body: API.ModuleItem, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/module', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除模块 DELETE /api/module */
export async function removeModule(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/module', {
    method: 'DELETE',
    params: {
      ...options,
    },
    ...(options || {}),
  });
}


/** 删除模块 DELETE /api/module */
export async function batchRemoveModules(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/module/batchdel', {
    method: 'DELETE',
    params: {
      ...options,
    },
    ...(options || {}),
  });
}
